package com.mew.chess.core.game.shbz.game.message;

import com.zebra.common.ZebraBaseMessage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class ArtilleryDropMessage extends ZebraBaseMessage<ArtilleryDropMessage> {

    private int seatNo;
    private int[] artillerys; // 0 青铜 1白银 2黄金 3 TNT 5 核能
    private long awardNumber; // 弹头 释放 获取奖励
    private long goldNumber;
    private float x; //X坐标
    private float y; //y 坐标

    @Override
    public void write(ByteBuf b) {

        writeInt(b,seatNo);
        writeIntArray(b,artillerys);
        writeLong(b,awardNumber);
        writeLong(b,goldNumber);
        writeFloat(b,x);
        writeFloat(b,y);
    }

    @Override
    public ArtilleryDropMessage read(ByteBuf b) {
        ArtilleryDropMessage message = new ArtilleryDropMessage();
        message.seatNo = readInt(b);
        message.artillerys = readIntArray(b);
        message.x = readFloat(b);
        message.y = readFloat(b);
        return message;
    }
}
